package com.zhucx.parser.htmlsucker;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * 文章对象
 */
public class Article {

    @Override
    public String toString() {
        return String.format("title:%s\npushTime:%s\nkeywords:%s\ndescription:%s\nauthor:%s\ndate:%s\nimage:%s\ncontent:\n%s",
                title,pushTime, String.join(",", keywords), description, author, date, image, content);
    }

    private String title;
    private String pushTime;
    private Collection<String> keywords;
    private String description;
    private String content;
    private String author;
    private Date date;
    private String image;

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Collection<String> getKeywords() {
        return keywords;
    }

    public void setKeywords(Collection<String> keywords) {
        this.keywords = keywords;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static void main(String[] args) {
        String tt = "E:/ASD/ASD/asdasd.jpg";

    }
    public String getContent() {
        //修改content img 路径
        Document document = Jsoup.parse(content);
        List<Element> imgEls = document.getElementsByTag("img");
        for(Element ek:imgEls){
//            ek.attr("src",ek)
        }

        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public void setPushTime(String pushTime) {
        this.pushTime = pushTime;
    }
    public String getPushTime() {
        return pushTime;
    }
}
